package com.cgbl.cg.adapter

import android.graphics.Bitmap
import android.text.TextUtils
import android.util.Log
import android.widget.ImageView
import com.bumptech.glide.Glide
import com.bumptech.glide.load.DataSource
import com.bumptech.glide.load.engine.GlideException
import com.bumptech.glide.request.RequestListener
import com.bumptech.glide.request.target.Target
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.cgbl.cg.R
import com.robot.base.model.CollectDetailBean
import com.robot.base.model.WorksBean
import com.robot.base.utils.pic.ImageLoaderUtils

class WorksCollectionAdapter2 :
    BaseQuickAdapter<CollectDetailBean, BaseViewHolder>(R.layout.app_item_works_collection) {

    private var isEditModel = hashMapOf<Int, Boolean>()

    override fun convert(holder: BaseViewHolder, item: CollectDetailBean) {
        val img = if (TextUtils.isEmpty(item.collectImages)) {
            R.mipmap.ic_collect_folder_default_img
        } else {
            item.collectImages
        }
        ImageLoaderUtils.displayRound(
            context, holder.getView(R.id.iv_project_img), img, 8
        )
        ImageLoaderUtils.displayCircle(
            context, holder.getView(R.id.iv_user_avatar), item.accountHead
        )
        holder.setText(R.id.tv_project_name, item.collectName)
        holder.setText(R.id.tv_username, item.accountNickName)
        holder.setText(R.id.tv_num, item.followCount)
        holder.setGone(R.id.iv_more, false)
        holder.setGone(R.id.item_iv_state, false)
        holder.setImageResource(
            R.id.item_iv_state, if (item.status == "0") {
                R.mipmap.ic_my_collection_open
            } else {
                R.mipmap.ic_my_collection_close
            }
        )
    }
}